﻿using MediatR;
using T.Personnel.API.Application.Command.ApprovalCommand;
using T.Personnel.Repository.Interface;

namespace T.Personnel.API.Application.CommandHandler.ApprovalHandler
{
    public class AddEntryApprovalHandler : IRequestHandler<AddEntryApprovalCommand, int>
    {
        private readonly IApprovalRepository approvalRepository;

        public AddEntryApprovalHandler(IApprovalRepository approvalRepository)
        {
            this.approvalRepository = approvalRepository;
        }

        public async Task<int> Handle(AddEntryApprovalCommand request, CancellationToken cancellationToken)
        {
            return await approvalRepository.AddEntryApprovalAsync(request);
        }
    }
}
